Skip to content

Fix bitwise ops encoding and add execution tests#106

Merged
maleadt merged 1 commit intoJuliaGPU:mainfrom
0xtaruhi:fix/bitwise-ops-and-not-int
Mar 17, 2026
Merged

Fix bitwise ops encoding and add execution tests#106
maleadt merged 1 commit intoJuliaGPU:mainfrom
0xtaruhi:fix/bitwise-ops-and-not-int

Conversation

@0xtaruhi
Copy link
Contributor

@0xtaruhi 0xtaruhi commented Mar 4, 2026

Summary

  • Fix ShLIOp encoding to include the missing overflow parameter (was causing tileiras crashes)
  • Refactor andi/ori/xori emit functions to use shared emit_binop! helper
  • Add codegen tests for bitwise ops (andi, ori, xori, shli, shri)
  • Add execution tests for bitwise ops to verify end-to-end correctness through tileiras

Changes

File Change
src/bytecode/encodings.jl Add overflow param to encode_ShLIOp!
src/compiler/intrinsics/arithmetic.jl Refactor andi/ori/xori to use emit_binop!
test/codegen/operations.jl Codegen tests for bitwise ops
test/execution/basic.jl Execution tests: AND, OR, XOR, shift left, shift right, combined

Notes

The not_int support for for-loop iteration has been split into a separate PR as suggested in review.

@maleadt
Copy link
Member

maleadt commented Mar 4, 2026

Thanks. The not_int fix for loops seems a bit out of place, maybe move to a separate PR including tests?
Also, this would benefit from some execution tests to catch the tileiras crash you reported.

@0xtaruhi 0xtaruhi force-pushed the fix/bitwise-ops-and-not-int branch from 95b5b31 to d6f1289 Compare March 6, 2026 03:03
@0xtaruhi 0xtaruhi changed the title Fix bitwise ops and add not_int support for for-loop iteration Fix bitwise ops encoding and add execution tests Mar 6, 2026
@0xtaruhi
Copy link
Contributor Author

0xtaruhi commented Mar 6, 2026

Updated per review feedback:

  1. Moved not_int to a separate PRAdd not_int intrinsic for for-loop iteration support #107, with its own codegen + execution tests (covering three for-loop scenarios).
  2. Added execution tests — 6 kernels going through the full tileiras → CUBIN → GPU pipeline, covering &, |, xor, <<, >>, and a combined expression (a & b) | (a ^ b). The ShLIOp encoding bug would have been caught by these.

This PR now focuses purely on bitwise ops: encoding fix + emit_binop! refactor + tests.

Copy link
Member

@maleadt maleadt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@0xtaruhi 0xtaruhi force-pushed the fix/bitwise-ops-and-not-int branch from d6f1289 to 388e6af Compare March 12, 2026 08:43
- Fix ShLIOp encoding to include overflow parameter
- Refactor andi/ori/xori emit to use shared emit_binop! helper
- Add codegen tests for bitwise ops (andi, ori, xori, shli, shri)
- Add execution tests for bitwise ops to catch tileiras compilation issues
@maleadt maleadt force-pushed the fix/bitwise-ops-and-not-int branch from 388e6af to 22acc2e Compare March 17, 2026 14:19
@maleadt maleadt merged commit 6292a7b into JuliaGPU:main Mar 17, 2026
9 checks passed
@maleadt
Copy link
Member

maleadt commented Mar 17, 2026

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants